Continue Statement

The continue is used to skip the remaining loop code segment is the condition is satisfied. In this For loop example:
	<!DOCTTYPE html> 
<!--Loop5.html -->
<html>
<head>
<title> Loop including a continue statement </title>
<script >
<!--
var counter; //counter
for (counter = 1; counter <=5; ++counter) //begining of the foor loop
{
if (counter == 4 )
continue; //skip the rest of the for loop if counter equals 4
document.writeln("<p style = 'font-size: " + counter + "ex'>HTML 5 font size" + counter + "</p>");
} //end of foor
// -->
</script>
</head>
<body></body>
</html>
If the counter is equal to 4, the remaining code after the if statement is skipped. See the output of this program:


For more details, please contact me here.
Date of last modification: March 26, 2019.